//
//  FindBackView.m
//  MyProject
//
//  Created by dllo on 15/11/14.
//  Copyright © 2015年 蓝鸥0825. All rights reserved.
//

#import "FindBackView.h"
#import "FindCollectionViewCell.h"

@implementation FindBackView

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
}


- (void)create{
    
    self.findCollectionFlowLayout = [[UICollectionViewFlowLayout alloc] init];
    self.findCollectionFlowLayout.itemSize = CGSizeMake(self.frame.size.width, self.frame.size.height);
    self.findCollectionFlowLayout.sectionInset = UIEdgeInsetsMake(45, 0, 0, 0);
    self.findCollectionFlowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    self.findCollectionFlowLayout.minimumLineSpacing = 0;
    
    
    
    self.findCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.frame.size.height * 0, self.frame.size.width, self.frame.size.height) collectionViewLayout:self.findCollectionFlowLayout];
    self.findCollectionView.backgroundColor = [UIColor clearColor];
    self.findCollectionView.pagingEnabled = YES;
    self.findCollectionView.showsHorizontalScrollIndicator = NO;
    self.findCollectionView.showsVerticalScrollIndicator =false;
    
    [self addSubview:self.findCollectionView];
    [self.findCollectionView registerClass:[FindCollectionViewCell class] forCellWithReuseIdentifier:@"reuse"];
    self.findCollectionView.dataSource = self;
    self.findCollectionView.delegate = self;
}





- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.arrayFindCollection.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    FindCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuse" forIndexPath:indexPath];
    cell.model = self.arrayFindCollection[indexPath.row];
    return cell;
    
    
}


- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    
}






@end
